<template>
	<div class="widget">
		<div class="widget-item">
			<p class="widget-title">标题</p>
			<el-input type="text" class="val" size="mini" @blur="commitData" v-model="formData.title" />
		</div>
		<div class="widget-item">
			<p class="widget-title-big">设置全局变量</p>
			<!-- <br /> -->
		</div>
		<div class="widget-item">
			<p class="widget-title">变量1</p>
			<el-input type="text" class="val" size="mini" @blur="commitData" v-model="formData.param1" />
		</div>
		<div class="widget-item">
			<p class="widget-title">变量2</p>
			<el-input type="text" class="val" size="mini" @blur="commitData" v-model="formData.param2" />
		</div>
		<div class="widget-item">
			<p class="widget-title">变量3</p>
			<el-input type="text" class="val" size="mini" @blur="commitData" v-model="formData.param3" />
		</div>
		<div class="widget-item">
			<p class="widget-title">变量4</p>
			<el-input type="text" class="val" size="mini" @blur="commitData" v-model="formData.param4" />
		</div>
		<div class="widget-item">
			<p class="widget-title">变量5</p>
			<el-input type="text" class="val" size="mini" @blur="commitData" v-model="formData.param5" />
		</div>
		<!-- <div>
      <el-button @click="commitData">确定</el-button>
    </div>
    -->
	</div>
</template>
<script>
// import DagGraph from "@/views/dag/dagEdit/graph";
// let graph = null;

export default {
	data() {
		return {
			formData: {},
		};
	},
	props: ["data"],
	watch: {
		data(val) {
			console.log("data", val);
		},
	},
	methods: {
		commitData() {
			let content = JSON.parse(JSON.stringify(this.formData));
			this.$EventBus.$emit("defaultValue", content);
		},
	},
	mounted() {
		if (this.data) {
			if (typeof this.data == "object") {
				let data = JSON.parse(JSON.stringify(this.data));
				this.formData = data;
			} else this.formData = JSON.parse(this.data);
		}
	},
};
</script>

<style lang="less" scoped>
.val {
	width: 180px;
	line-height: 32px;
}

.dialog-val {
	margin: 10px 0;
}
</style>
